package com.boot.stomp.client;


import com.boot.web.http.HttpModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;

//@Component
public class AccountClient2 {

    @Autowired
    private RestTemplate restTemplate;

    public ResponseEntity<HttpModel<AccountInfo>> getAccountInformation(String authorization) {
        HttpHeaders headers = new HttpHeaders();
        headers.set(HttpHeaders.AUTHORIZATION, authorization);
        return restTemplate.exchange("http://security-service/account/information", HttpMethod.GET,
                new HttpEntity<>(headers), new ParameterizedTypeReference<HttpModel<AccountInfo>>() {
                });
    }

}
